

-----------------------------------------------------------------
-----------------------------------------------------------------
-----------------------------------------------------------------

IF EXISTS (SELECT * FROM SYSOBJECTS WHERE name='SeguridadMessageException' and XTYPE='U')
BEGIN
	DROP TABLE [dbo].[SeguridadMessageException]
END
--GO
CREATE TABLE [SeguridadMessageException]
(
	 [ID] INT IDENTITY(1000,10) NOT NULL PRIMARY KEY
	,[FechaGrab] SMALLDATETIME NOT NULL DEFAULT GETDATE()
	--,[Usuario] VARCHAR(32) NOT NULL
	,[ERROR_NUMBER] INT NOT NULL
    ,[ERROR_SEVERITY] INT NOT NULL
    ,[ERROR_STATE] INT NOT NULL
    ,[ERROR_PROCEDURE] VARCHAR(128) NOT NULL
    ,[ERROR_LINE] INT NOT NULL
    ,[ERROR_MESSAGE]  VARCHAR(2048) NOT NULL
    ,[ERROR_MESSAGE_MODIFIED] VARCHAR(2048)
    ,[ERROR_DESCRIPTION] VARCHAR(2048)
);

ALTER TABLE [SeguridadMessageException] ADD CONSTRAINT [UQ_SeguridadMessageException] UNIQUE ([ERROR_NUMBER],[ERROR_SEVERITY],[ERROR_STATE],[ERROR_PROCEDURE],[ERROR_LINE],[ERROR_MESSAGE])
--GO